The technical field relates to digital computer systems debugging. More particularly, it relates to methods and an apparatus for debugging IA-32 systems running on an IA-64 CPU.
In the field of computer architecture, it is desirable to provide means of debugging systems. This is especially true in mixed architectures, such as the IA-64 architecture, which supports two instruction setsxe2x80x94the IA-32 variable length instruction set and the enhanced mode (EM) instruction set. A single machine, such as an IA-64 microprocessor, may process instructions from both these instruction sets. In debugging problems with processor execution, it may become necessary to investigate the sequence of instructions executed immediately prior to the problem. With respect to the IA-64 machine, it is desirable to provide debugging methods for IA-32 or x86 instructions, as well as native instructions.
Various methods exist by which computer systems may be debugged. For example, some central processing units (CPUs) provide debug hints in the form of xe2x80x9cbranch trace messages.xe2x80x9d These branch trace messages send out a special signature (e.g., source, destination address of branch) on the processor bus. One debugging technique uses xe2x80x9cbreakpointsxe2x80x9d that cause the CPU to respond in a certain specified way when a certain instruction is executed. In order to gather information about the architectural state of the machine using a breakpoint, it is necessary to stop the machine at the breakpoint. While some techniques like xe2x80x9cSample-on-the-Flyxe2x80x9d allow a portion of the machine state to be sampled while a program executes, the information recorded is overwritten in each new cycle, giving no temporal information about the execution history. Scan methods have been employed to interrogate the internal state of the machine by stopping the CPU for a clock cycle, scanning the processor state, and sending it to a system-visible entity such as a processor bus or register. The CPU is clocked for a cycle, new state information gathered and the process repeats.
The problem with existing debug methods is that they are slow, complex, and intrusive. These debug techniques require stopping the program, reading all of the information, and then continuing the program. Also, some debug techniques require some knowledge about the failing condition. For instance, the breakpoint technique requires identifying a breakpoint in the vicinity of the suspected problem (for example, a range of instruction addresses) and examining the CPU state when the machine halts at the breakpoint. This is largely a process of trial and errorxe2x80x94making an educated guess regarding the location of the breakpoint, re-executing certain instructions, and determining whether the error exists. Sometimes the very act of setting up a breakpoint may perturb the machine state enough such that the error is masked.
Also, existing debug techniques do not allow the user to efficiently switch modes of operation. That is, traditional methods may allow the user to analyze both macroinstructions and microinstructions, but not by the same method.
What is needed is a better way of accessing the execution history. In particular, what is needed is a non-intrusive means of gathering instruction information as the instructions execute without stopping the machine to set a breakpoint or to scan particular nodes.
A method for creating a trace of emulated instructions from an emulated instruction set when running on hardware optimized for a different instruction set, such as IA-32 instructions running on an IA-64 machine is described. An execution trace buffer is created that maintains desired information about instructions as they are executed and retired. A system may be configured such that certain desired information helpful to debugging the system may be written to the buffer as the instructions are retired. This information may include the addresses of sequential or branch instructions, or other relevant information that can be gathered continuously and non-intrusively as instructions are executed. The information may be read from the buffer and output in a machine-visible form at the user""s convenience.
A computer system capable of creating an easily readable execution history by using an execution trace buffer. The execution trace buffer maintains certain information about instructions as they are executed and retired. The computer system may be configured such that certain desired information helpful to debugging the system may be written to the buffer as the instructions are retired. This information may include the addresses of sequential or branch instructions, or other relevant information that can be gathered continuously and non-intrusively as instructions are executed. The information may be read from the buffer and output in a machine-visible form at the user""s convenience.